package com.lzycug;

public class PayThread implements Runnable {
    private final String payMethod;

    private final PayCallBack callBack;

    public PayThread(String payMethod, PayCallBack callBack) {
        this.payMethod = payMethod;
        this.callBack = callBack;
    }

    @Override
    public void run() {
        String name = Thread.currentThread().getName();
        while (true) {
            System.out.println(name + "=======查询支付结果中============");
            if (FunctionalDemo.payStatus) {
                break;
            }
            try {
                Thread.sleep(2 * 1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        System.out.println(name + "=======查询结果完成，进行下一步业务");
        String payNo = "0|1|23400";
        callBack.process(payMethod + "支付，支付编号：", payNo);
    }

}
